package com.hairline.hairlinemarket.mapper;

import com.hairline.hairlinemarket.bean.MarketOrder;
import com.hairline.hairlinemarket.bean.MarketOrderExample;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

public interface MarketOrderMapper {
    long countByExample(MarketOrderExample example);

    int deleteByExample(MarketOrderExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(MarketOrder record);

    int insertSelective(MarketOrder record);

    List<MarketOrder> selectByExample(MarketOrderExample example);

    MarketOrder selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") MarketOrder record, @Param("example") MarketOrderExample example);

    int updateByExample(@Param("record") MarketOrder record, @Param("example") MarketOrderExample example);

    int updateByPrimaryKeySelective(MarketOrder record);

    int updateByPrimaryKey(MarketOrder record);

    int updateWithOptimisticLocker(@Param("lastUpdateTime") Date lastUpdateTime, @Param("order") MarketOrder order);

    @Select("select sum(comments) from market_order where user_id = #{userId}")
    Integer selectCountUncomment(Integer userId);

    @Select("select sum(pay_id) from market_order where user_id = #{userId}")
    Integer selectCountUnpaid(Integer userId);
}
